#!/usr/bin/env python
#coding: utf-8
# 获取负载信息模块
#
import commands

def monitor():
	shell_command = 'uptime'

	status,result = commands.getstatusoutput(shell_command)
	if status != 0:
		value_dic = {'status':status}
	else:
		# value_dic = {}
		uptime = result.split(',')[:1][0]
		# print uptime
		# # print result
		# print '----------'
		load1,load5,load15 = result.split('load average:')[1].split(',')
		# print load1,load5,load15
		value_dic = {
			'uptime':uptime,
			'load1':load1,
			'load5':load5,
			'load15':load15,
			'status':status
		}
		return value_dic

